package  
{
	import org.flixel.FlxPoint;
	public class Projectile extends GameObject
	{
		protected var owner: GameObject;
		private const speed: int = 32;

		public function Projectile(Owner: GameObject)
		{
			owner = Owner;
			super(owner.x, owner.y, owner.z-1);
			exists = false;
			antialiasing = true;
		}
		
		public function shoot(ang: Number): void {
			if (exists) return;

			exists = true;
			facing = owner.facing;
			// these literals are specific to the sword, this needs fixing (projectile origin point)
			x = owner.x + 6;
			y = owner.y + 4;
			angle = ang;
			var rad: Number = ang * Math.PI / 180;
			velocity.x = Math.cos(rad) * speed;
			velocity.y = Math.sin(rad) * speed;
		}
		
		override public function update():void 
		{
			//angle += 5;
			//if (angle >= 360) angle = 0;
			super.update();
			if (touching)
				kill();
		}
	}

}